Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Objects /
Chapter 4 - Colors and Color-Related Objects / Colors and Color-Related Objects Reference
Color Set Functions / Retrieving and Replacing Colors in a Color Set


GXGetColorSetParts

You can use the GXGetColorSetParts function to retrieve specified colors from a color set object.

long GXGetColorSetParts(gxColorSet source, long index, long count,
                         gxColorSpace *space, gxSetColor data[]);
source
A reference to the color set object whose color values you want to retrieve.
index
The first color value to retrieve. To retrieve the first color value in the color set, specify 1 for this parameter.
count
The number of color values to retrieve. Specify gxSelectToEnd to retrieve all color values in the color set including and beyond index.
space
A pointer to a color space value. On return, specifies the color space for the source color set.
data
An array of gxSetColor color values. On return, contains the specified subset of color values from the source color set.
function result
The number of color values in the range specified by index and count.
DESCRIPTION
The GXGetColorSetParts function retrieves the specified color values from the source color set and returns them in the data array. It also returns the color set's color space in the location pointed to by the space parameter. The function result is the number of color values copied into the data array.

Before calling GXGetColorSetParts, you must allocate an array of sufficient size to hold the specified number of color values. If instead you pass nil for the data parameter, the function does not return any color values, but nonetheless returns (as
its function result) the number of colors in the specified range. Thus you can make an initial call to GXGetColorSetParts to determine the size of the array to allocate, and then call it once more to get the color values themselves.

ERRORS, WARNINGS, AND NOTICES
Errors 
out_of_memory 
colorSet_is_nil
index_is_less_than_one(debugging version)
count_is_less_than_one(debugging version)
Warnings 
index_out_of_range 
count_out_of_range 
SEE ALSO
To retrieve the entire array of color values from a color set object, use the GXGetColorSet function, described on page 4-73. To replace the entire array of color values in a color set object, use the GXSetColorSet function, described in the previous section. To replace some of the color values in a color set object, use the GXSetColorSetParts function, described in the next section.

The gxSetColor union is described on page 4-56.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996